/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

package models;

import java.io.Serializable;
import java.sql.Date;

/**
 * This class represents an user in the database 
 * @author gabriellebotbol
 */
public class Users implements Serializable
{
 
    //<editor-fold defaultstate="collapsed" desc="Properties">
    private int idFriend;
    private String visibility;
    public String  getVisibility()
    {
        return this.visibility;
    }
    
    /**
     * Get the value of idFriend
     *
     * @return the value of idFriend
     */
    public int getIdFriend() {
        return idFriend;
    }

    private String username;
    /**
     * Get the value of username
     *
     * @return the value of username
     */
    public String getUsername()
    {
        return username;
    }
    private String password;
    
    /**
     * Get the value of password
     *
     * @return the value of password
     */
    public String getPassword()
    {
        return password;
    }
    private String firstname;
    
    /**
     * Get the value of firstname
     *
     * @return the value of firstname
     */
    public String getFirstname() {
        return firstname;
    }
    private String lastname;
    
    /**
     * Get the value of lastname
     *
     * @return the value of lastname
     */
    public String getLastname() 
    {
        return lastname;
    }
    private Date birthdate;
    
    /**
     * Get the value of birthdate
     *
     * @return the value of birthdate
     */
    public Date getBirthdate() 
    {
        return birthdate;
    }
    private String mail;
    
    /**
     * Get the value of mail
     *
     * @return the value of mail
     */
    public String getMail() 
    {
        return mail;
    }
    private long phone;
    
    /**
     * Get the value of phone
     *
     * @return the value of phone
     */
    public long getPhone() 
    {
        return phone;
    }
    private String city;
    
    /**
     * Get the value of city
     *
     * @return the value of city
     */
    public String getCity() 
    {
        return city;
    }
    private String country;
    
    /**
     * Get the value of country
     *
     * @return the value of country
     */
    public String getCountry() 
    {
        return country;
    }
    private String avatar;
    
    /**
     * Get the value of avatar
     *
     * @return the value of avatar
     */
    public String getAvatar() 
    {
        return avatar;
    }
    //</editor-fold>

    private Users() 
    {
    }
    /**
     * creates an instance of Users
     * @param idFriend
     * @param username
     * @param password
     * @param firstname
     * @param lastname
     * @param birthdate
     * @param mail
     * @param phone
     * @param city
     * @param country
     * @param avatar
     * @param visibility
     */
    public Users(int idFriend, String username, String password, String firstname, String lastname, Date birthdate, String mail, long phone, String city, String country, String avatar, String visibility) {
        this.idFriend = idFriend;
        this.username = username;
        this.password = password;
        this.firstname = firstname;
        this.lastname = lastname;
        this.birthdate = birthdate;
        this.mail = mail;
        this.phone = phone;
        this.city = city;
        this.country = country;
        this.avatar = avatar;
        this.visibility=visibility;
    }
    
   

    @Override
    public String toString() 
    {
        StringBuilder builder=new StringBuilder();
        builder.append("username: ");
        builder.append(this.getUsername());
        builder.append(" first name: ");
        builder.append(this.getFirstname());
        builder.append(" last name: ");
        builder.append(this.getLastname());
        builder.append(" mail address: ");
        builder.append(this.getMail());
        builder.append("\n");
        
        return builder.toString();
    }

    @Override
    protected Object clone() throws CloneNotSupportedException 
    {
        Users user=new Users(this.getIdFriend(),this.getUsername(),this.getPassword(),this.getFirstname(),this.getLastname(),this.getBirthdate(),this.getMail(),this.getPhone(),this.getCity(),this.getCountry(),this.getAvatar(),this.getVisibility());
        
        return user;
    }

    @Override
    public boolean equals(Object obj) 
    {
        if(obj instanceof Users)
        {
            return (this.hashCode()==obj.hashCode());
        }
        return false;
    }

    @Override
    public int hashCode() 
    {
        int hash = 7;
        hash = 59 * hash + (this.username != null ? this.username.hashCode() : 0);
        hash = 59 * hash + (this.password != null ? this.password.hashCode() : 0);
        hash = 59 * hash + (this.firstname != null ? this.firstname.hashCode() : 0);
        hash = 59 * hash + (this.lastname != null ? this.lastname.hashCode() : 0);
        hash = 59 * hash + (this.birthdate != null ? this.birthdate.hashCode() : 0);
        hash = 59 * hash + (this.mail != null ? this.mail.hashCode() : 0);
        hash = (int) (59 * hash + this.phone);
        hash = 59 * hash + (this.city != null ? this.city.hashCode() : 0);
        hash = 59 * hash + (this.country != null ? this.country.hashCode() : 0);
        hash = 59 * hash + (this.avatar != null ? this.avatar.hashCode() : 0);
        hash = 59 * hash + this.getIdFriend();
        return hash;
    }

}
